package cn.wen.base.image;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import cn.wen.base.image.glide.GlideEngine;


/**
 * 加载图片的Util类
 */

public class ImageLoader {

    private static IImageEngine mImageEngine = new GlideEngine();

    /**
     * 改变图片加载的引擎--》》可以自己写一套
     */
    public static void changeImageEngine(IImageEngine imageEngine) {
        mImageEngine = imageEngine;
    }

    public static void displayImage(ImageView imageView, String imageUrl, int errorResId) {
        mImageEngine.displayImage(imageView.getContext(), imageView, imageUrl, errorResId);
    }
    public static void displayView(View imageView, String imageUrl, int errorResId) {
        mImageEngine.displayView(imageView.getContext(), imageView, imageUrl, errorResId);
    }
    public static void displayImage(ImageView imageView, String imageUrl, boolean isAnimation) {
        mImageEngine.displayImage(imageView.getContext(), imageView, imageUrl, isAnimation);
    }

    public static void displayImage(ImageView imageView, String imageUrl) {
        mImageEngine.displayImage(imageView.getContext(), imageView, imageUrl);
    }

    public static void displayImage(ImageView imageView, int resId) {
        mImageEngine.displayImage(imageView.getContext(), imageView, resId);
    }

    public static void displayCircleImage(ImageView imageView, String imageUrl, int errorResId) {
        mImageEngine.displayCircleImage(imageView.getContext(), imageView, imageUrl, errorResId);
    }

    public static void displayRadiusImage(ImageView imageView, String imageUrl, int errorResId, float radius) {
        mImageEngine.displayRadiusImage(imageView.getContext(), imageView, imageUrl, errorResId, radius);
    }

    public static void clear(Context object) {
        mImageEngine.clear(object);
    }


}
